<?php

/** 
 * @author Administrator
 * 
 * 
 */
include_once S_ROOT."./source/db/db_payment.php";
require_once (S_ROOT.'./data/data_paymentfrom.php');

abstract class paymentBase {
	
	protected $payid;
	protected $rate;
	protected $status;
	protected $db_payment;
	const CONVERSION_RATE = 10;
	
	function __construct($fromflag) {
		$this->payid = $paymentfromarr[$fromflag]['id'];
		$this->rate = $paymentfromarr[$fromflag]['rate'];
		$this->status = $paymentfromarr[$fromflag]['state'];
		$this->db_payment = new db_payment($this->pid);
	}
	
	function get_status()
	{
		return $this->status?false:true;
	}
	
	
	protected function add_points($uid,$amount)
	{
		$buypoints = intval($amount*self::CONVERSION_RATE);
		$this->db_payment->add_points($uid,$amount,$buypoints,$this->rate);
	}
	
	protected function add_paylog($logarr)
	{
		$this->db_payment->inserttable('payment_log',$logarr);
	}
	
	abstract function request_payment();
	abstract function parse_payresult();
	
}

?>